<?php
class BASActiveRecord extends CActiveRecord 
{
	private static $dbBAS = null;

	protected static function getAdvertDbConnection()
	{
		if (self::$dbBAS !== null)
		return self::$dbBAS;
		else
		{
			self::$dbBAS = Yii::app()->dbBAS;
			if (self::$dbBAS instanceof CDbConnection)
			{
				self::$dbBAS->setActive(true);
				return self::$dbBAS;
			}
			else
			throw new CDbException(Yii::t('yii','Active Record requires a "db" CDbConnection application component.'));
		}
	}
}